# CODE CELL
#
# Write the park function so that it actually parks your vehicle.

from Car import Car
import time

def park(car):
    # TODO: Fix this function!
    #  currently it just drives back and forth
    #  Note that the allowed steering angles are
    #  between -25.0 and 25.0 degrees and the 
    #  allowed values for gas are between -1.0 and 1.0
    
    # 右方向打死倒车2.7秒
    car.steer(25.0)
    car.gas(-1.0)
    time.sleep(2.7) # note how time.sleep works
    
    # 左方向打死倒车2.4秒
    car.steer(-25.0)
    time.sleep(2.4)
    
    # 回轮，前进1.2秒
    car.steer(0.0)
    car.gas(1.0)
    time.sleep(1.2)
    
    # 0.1速度倒车1秒，停止前进
    car.gas(-0.1)
    time.sleep(1.0)
    
    # 松油门
    car.gas(0.0)

car = Car()
park(car)
